<style lang="scss">
  @import 'index';
</style>

<template>
  <div class="ga-container">
    <div class="ga-order-detail">
      <!--地址不为空-->
      <div class="address">
        <p class="tit mr10">收货地址:</p>
        <div>
          <p class="p1">
            <span class="mr10">{{detail.consignee}}</span>
            <span class="mr10">{{detail.mobile}}</span>
            <!-- <span class="mark">家</span> -->
          </p>
          <p class="p2">{{detail.province}}{{detail.city}}{{detail.district}}{{detail.address}}</p>
        </div>
      </div>

      <!--商品列表-->
      <ul class="ga-group-list ga-media-list">
        <li v-for="(item,index) in detail._order_goods" :key="index">
          <a class="item" href="#">
            <div class="item-media">
              <div class="img-box">
                <img :src="item.goods_thumb" alt="">
              </div>
            </div>
            <div class="item-inner">
              <p class="title">{{item.goods_name}}</p>
              <!-- <p class="p1">{{item.goods_attr ? item.goods_attr : ''}}</p> -->
              <div class="con">
                <span>{{item.goods_type == 1?'普通商品':'货柜编码：'+item.co_sn}}</span>
                <span v-if="detail.is_pay == 1 && item.pe_status == 0">{{item.goods_type == 2? '取件码：'+item.pe_code : ''}}</span>
                <div>
                  <span>x{{item.goods_number}}</span>
                  <span class="price">¥{{item.goods_price}}</span>
                </div>
              </div>
            </div>
          </a>
        </li>
      </ul>

      <ul class="ga-cell mt10 product-price">
        <li class="item">
          <span>商品总价</span>
          <span class="span2">¥{{detail.goods_amount}}</span>
        </li>
        <li class="item mt20" v-if="detail.is_pay == 1">
          <span>实付金额</span>
          <span class="span2">¥{{detail.goods_amount}}</span>
        </li>
      </ul>

      <!--订单信息-->
      <div class="order-msg">
        <p>订单编号：{{detail.order_sn}}</p>
        <p>下单时间：{{detail.add_time}}</p>
        <p>支付状态：{{detail.is_pay == 1 ? '已支付' : '未支付'}}</p>
      </div>
      <!--订单信息-->
    </div>
  </div>
</template>

<script>
import {isLogin,handleError,showToast} from '@/utils/handleLogin'
export default {

  data () {
    return {
       detail:{}
    }
  },
  methods: {
    async load () {
      let params = {
         id: this.$root.$mp.query.id
      }
      this.$_util.ajax.post('https://guo-a.com/mapi/nearby/orderdetail?token=' + this.$store.state.Token,params).then((res) => {
         if(res.code === 200){
            this.detail = res.data
         }
      })
    }
  },
  created () {

  },
  onShow () {
     isLogin(()=>{
      if(!this.$root.$mp.query.hasOwnProperty('id')){
          wx.navigateBack()
          return false
      }
      this.detail = {}
      this.load()
     })
  },
  mounted () {

  }
}
</script>
